package com.ruoyi.employee.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.employee.mapper.employeePostMapper;
import com.ruoyi.employee.domain.employeePost;
import com.ruoyi.employee.service.IemployeePostService;

/**
 * 岗位管理Service业务层处理
 * 
 * @author wsy
 * @date 2025-09-02
 */
@Service
public class employeePostServiceImpl implements IemployeePostService 
{
    @Autowired
    private employeePostMapper employeePostMapper;

    /**
     * 查询岗位管理
     * 
     * @param postId 岗位管理主键
     * @return 岗位管理
     */
    @Override
    public employeePost selectemployeePostByPostId(Long postId)
    {
        return employeePostMapper.selectemployeePostByPostId(postId);
    }

    /**
     * 查询岗位管理列表
     * 
     * @param employeePost 岗位管理
     * @return 岗位管理
     */
    @Override
    public List<employeePost> selectemployeePostList(employeePost employeePost)
    {
        return employeePostMapper.selectemployeePostList(employeePost);
    }

    /**
     * 新增岗位管理
     * 
     * @param employeePost 岗位管理
     * @return 结果
     */
    @Override
    public int insertemployeePost(employeePost employeePost)
    {
        // 设置默认状态为正常(0)
        if (employeePost.getStatus() == null || employeePost.getStatus().isEmpty()) {
            employeePost.setStatus("0");
        }
        employeePost.setCreateTime(DateUtils.getNowDate());
        return employeePostMapper.insertemployeePost(employeePost);
    }

    /**
     * 修改岗位管理
     * 
     * @param employeePost 岗位管理
     * @return 结果
     */
    @Override
    public int updateemployeePost(employeePost employeePost)
    {
        employeePost.setUpdateTime(DateUtils.getNowDate());
        return employeePostMapper.updateemployeePost(employeePost);
    }

    /**
     * 批量删除岗位管理
     * 
     * @param postIds 需要删除的岗位管理主键
     * @return 结果
     */
    @Override
    public int deleteemployeePostByPostIds(Long[] postIds)
    {
        return employeePostMapper.deleteemployeePostByPostIds(postIds);
    }

    /**
     * 删除岗位管理信息
     * 
     * @param postId 岗位管理主键
     * @return 结果
     */
    @Override
    public int deleteemployeePostByPostId(Long postId)
    {
        return employeePostMapper.deleteemployeePostByPostId(postId);
    }
}
